package com.vigmonk.utils 
{
	import flash.display.DisplayObject;	
	
	/**
	 * CurrentUrl.as
	 * @author VIGMONK
	 */
	 
	public class CurrentUrl 
	{
		public function CurrentUrl():void{}
		
		/**
		 * 
		 * import com.vigmonk.utils.CurrentUrl;
		 * 
		 * trace(CurrentUrl.getPath(this));
		 * trace(CurrentUrl.getRootPath(this));
		 *
		 * 
		 */
		public static function getFullPath(_dispObj:DisplayObject):String
		{
			var tempArr:Array = getPathArr(_dispObj);
			tempArr.splice(tempArr.length-1,1);
			return tempArr.join('/')+'/';
		}
		
		public static function getRootPath(_dispObj:DisplayObject):String
		{
			var tempArr:Array = getPathArr(_dispObj);
			tempArr.splice(0,3);
			return tempArr.join('/')+'/';
		}
		
		private static function getPathArr(_dispObj:DisplayObject):Array
		{
			var path:String = _dispObj.root.loaderInfo.url;
			var tempArr:Array = path.split('/');
			return tempArr;
		}
	}
}
